package com.hyt.it.ogt.controller.ykcj.exam;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.exam.ExamPostScoreLineSettingSub;
import com.hyt.it.ogt.ykcj.service.exam.IExamPostScoreLineSettingSubService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;

/**
 * 招考职位分数线设置科目分数Controller
 * 
 * @author admin
 * @date 2021-09-09
 */
@Api(tags = "exam.5.招考职位分数线设置科目分数", value = "招考职位分数线设置科目分数请求接口")
@ApiSort(value = 105)
@RestController
@RequestMapping("/exam/postScoreLineSettingSub")
public class ExamPostScoreLineSettingSubController extends BaseController
{
    @Autowired
    private IExamPostScoreLineSettingSubService examPostScoreLineSettingSubService;

    /**
     * 查询招考职位分数线设置科目分数列表
     */
    @ApiOperation("查询招考职位分数线设置科目分数列表")
    @GetMapping("/list")
    public TableDataInfo list(ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        startPage();
        List<ExamPostScoreLineSettingSub> list = examPostScoreLineSettingSubService.selectExamPostScoreLineSettingSubList(examPostScoreLineSettingSub);
        return getDataTable(list);
    }

    /**
     * 导出招考职位分数线设置科目分数列表
     */
    @ApiOperation("导出招考职位分数线设置科目分数列表")
    @Log(title = "招考职位分数线设置科目分数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        List<ExamPostScoreLineSettingSub> list = examPostScoreLineSettingSubService.selectExamPostScoreLineSettingSubList(examPostScoreLineSettingSub);
        ExcelUtil<ExamPostScoreLineSettingSub> util = new ExcelUtil<ExamPostScoreLineSettingSub>(ExamPostScoreLineSettingSub.class);
        return util.exportExcel(list, "招考职位分数线设置科目分数数据");
    }

    /**
     * 获取招考职位分数线设置科目分数详细信息
     */
    @ApiOperation("获取招考职位分数线设置科目分数详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(examPostScoreLineSettingSubService.selectExamPostScoreLineSettingSubById(id));
    }

    /**
     * 新增招考职位分数线设置科目分数
     */
    @ApiOperation("新增招考职位分数线设置科目分数")
    @Log(title = "招考职位分数线设置科目分数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        return toAjax(examPostScoreLineSettingSubService.insertExamPostScoreLineSettingSub(examPostScoreLineSettingSub));
    }

    /**
     * 修改招考职位分数线设置科目分数
     */
    @ApiOperation("修改招考职位分数线设置科目分数")
    @Log(title = "招考职位分数线设置科目分数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ExamPostScoreLineSettingSub examPostScoreLineSettingSub)
    {
        return toAjax(examPostScoreLineSettingSubService.updateExamPostScoreLineSettingSub(examPostScoreLineSettingSub));
    }

    /**
     * 删除招考职位分数线设置科目分数
     */
    @ApiOperation("删除招考职位分数线设置科目分数")
    @Log(title = "招考职位分数线设置科目分数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(examPostScoreLineSettingSubService.deleteExamPostScoreLineSettingSubByIds(ids));
    }
}
